F77 = @FC@
GCC = @CC@
FFLAGS = @FCFLAGS@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -w 
# CFLAGS = -O3 -ftree-vectorize -w -ffast-math @CPPFLAGS@
# CFLAGS = -DPROTOTYPE -Dalliant -w -ffast-math -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CFLAGS = -DPROTOTYPE -Dalliant -w -ffast-math -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
# DO THIS FOR UNIX:
#  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
#
# FOR OPENMP INCLUDE:
#  -fopenmp -O3
#

BIN = ../../bin

all: $(BIN)/2dx_ctffind3.exe $(BIN)/2dx_ctffind3_noOMP.exe $(BIN)/2dx_ctftilt.exe $(BIN)/ctffind3.exe

$(BIN)/ctffind3.exe: ctffind3.o iof.o ioc.o
	$(F77) $(FFLAGS) iof.o ioc.c -o $@ $< 

$(BIN)/2dx_ctffind3.exe: 2dx_ctffind3.o iof.o ioc.o
	$(F77) $(FFLAGS) -fopenmp iof.o ioc.c -o $@ $< 

$(BIN)/2dx_ctffind3_noOMP.exe: 2dx_ctffind3_noOMP.o iof.o ioc.o
	$(F77) $(FFLAGS) iof.o ioc.c -o $@ $< 

$(BIN)/2dx_ctftilt.exe: 2dx_ctftilt.o iof.o ioc.o
	$(F77) $(FFLAGS) iof.o ioc.o -o $@ $< 

ctffind3.o: ctffind3.f
	$(F77) $(FFLAGS) -c $< 

2dx_ctffind3.o: 2dx_ctffind3.f
	$(F77) $(FFLAGS) -fopenmp -c $< 

2dx_ctffind3_noOMP.o: 2dx_ctffind3_noOMP.f
	$(F77) $(FFLAGS) -c $< 

2dx_ctftilt.o: 2dx_ctftilt.f
	$(F77) $(FFLAGS) -c $< 

iof.o: iof.f
	$(F77) $(CFLAGS) -c $<

ioc.o: ioc.c
	$(GCC) $(CFLAGS) -c $<



clean:
	\rm -f ../../bin/2dx_ctffind3.exe
	\rm -f ../../bin/2dx_ctffind3_noOMP.exe
	\rm -f ../../bin/2dx_ctftilt.exe
	\rm -f *.o

